<template>
    <div id="app">
      <el-form label-width="100px">
        <el-form-item label="书名">
          {{secondhandBook.bookName}}
        </el-form-item>
        <el-form-item label="原价">
          {{secondhandBook.bookPrice}}
        </el-form-item>

        <el-form-item label="作者">
          {{secondhandBook.author}}
        </el-form-item>

        <el-form-item label="描述">
          {{secondhandBook.description}}
        </el-form-item>

        <el-form-item label="图片">
          <img :src="'http://localhost:8989/'+secondhandBook.productImage" width="500"/>
        </el-form-item>
        <el-form-item label="估价" v-if="role==2">
          <el-input v-model="secondhandBook.dangprice"></el-input>
        </el-form-item>

        <el-form-item v-if="role==2">
          <el-button type="primary" @click="volume()" >提交</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          secondhandBook: {},
        role:sessionStorage.getItem("role")
        }
      },
      created() {
        this.axios.get("/secondhandBook/selectOne/"+this.$route.query.sid).then((resp)=>{
          this.secondhandBook=resp.data;
        });
      },
      methods:{
        volume(){
          //发出ajax请求
          this.axios.put("/secondhandBook/updatePrice",this.secondhandBook).then((resp)=>{
            this.$router.push("/book/SecondhandList");
          })
        }
      }
    }
</script>


<style scoped>

</style>
